using System;
using Curriculum.Modelo.Clases;
using Curriculum.Utiles;

namespace Curriculum.Services
{
	/// <summary>
	/// Summary description for ITransaccion.
	/// </summary>
	public abstract class Transaccion
	{
		protected IObjetoId _objetoDeTransaccion;
		protected ServiceBase _srv;
		
		internal string IdTransaccion
		{
			get { return _objetoDeTransaccion.Id; }
		}

		public string TransaccionInfo
		{
			get
			{
				return string.Format("{0}: {1}", 
								this.GetType().ToString(), 
								_objetoDeTransaccion.GetType().ToString());				
			}
		}

		
		internal Transaccion(ServiceBase service, IObjetoId obj)
		{	
			_srv = service;
			_objetoDeTransaccion = obj;
			_objetoDeTransaccion.Id = IdGenerator.GetNextId(_objetoDeTransaccion.GetType(),  _srv.Container);
		}
		
	
		public abstract void Cerrar();
	}
}
